package com.qys.livesMall.event.listener;

import com.qys.livesMall.anchor.event.UserGradeIntegralEvent;
import com.qys.livesMall.anchor.event.pojo.UserGradeIntegralPOJO;
import com.qys.livesMall.anchor.service.UserGradeIntegralService;
import lombok.RequiredArgsConstructor;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import org.springframework.scheduling.annotation.Async;

@RequiredArgsConstructor
public class UserGradeIntegralListener {

    private final UserGradeIntegralService userGradeIntegralService;

    @Async
    @Order
    @EventListener(UserGradeIntegralEvent.class)
    public void addUserGradeIntegral(UserGradeIntegralEvent event){
        UserGradeIntegralPOJO pojo= (UserGradeIntegralPOJO) event.getSource();
        userGradeIntegralService.addUserGradeIntegral(pojo);
    }
}
